//
//  PayOrderTopView.m
//  Youhuiju
//
//  Created by 余尚飞 on 16/8/12.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "PayOrderTopView.h"

@interface PayOrderTopView ()

@property(nonatomic,strong)UILabel *titleLabel;//标题
@property(nonatomic,strong)UIButton *backButton;//返回
@property(nonatomic,strong)UIView *lineView;
@end

@implementation PayOrderTopView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self creatView];
    }
    return self;
}
-(void)creatView
{
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.textColor = [UIColor colorWithHexString:@"333333"];
    self.titleLabel.text = @"支付订单";
    self.titleLabel.textAlignment = 1;
    self.titleLabel.font = [UIFont systemFontOfSize:18 * FitH];
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.centerY.equalTo(self.mas_centerY);
        make.size.mas_offset(CGSizeMake(120 * FitW, 40 * FitH));
    }];
    
    self.backButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.backButton setBackgroundImage:LoadImage(@"back") forState:UIControlStateNormal];
    [self.backButton addTarget:self action:@selector(backButtonClickedAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.backButton];
    [self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(12 * FitW);
        make.top.equalTo(self.mas_top).offset(13 * FitH);
        make.size.mas_offset(CGSizeMake(19 * FitW, 19 * FitH));
    }];
    
    self.lineView = [[UIView alloc]init];
    self.lineView.backgroundColor = [UIColor colorWithHexString:@"eeeeee"];
    [self addSubview:self.lineView];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.bottom.equalTo(self.mas_bottom);
        make.height.mas_offset(1 * FitH);
    }];
}

-(void)backButtonClickedAction:(UIButton *)sender
{
    if (self.backButtonClickedHandler)
    {
        self.backButtonClickedHandler();
    }
}

@end


